package com.ms.infrastructure.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

import javax.sql.DataSource;

public class DbPropertySourcesPlaceholderConfigurer extends PropertySourcesPlaceholderConfigurer {

    @Override
   public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException{
        DataSource dataSource = beanFactory.getBean(DataSource.class);
        ParametroProperties dbProps = new ParametroProperties(dataSource);
        setProperties(dbProps);
        super.postProcessBeanFactory(beanFactory);
    }
}
